<!--
 * @Author: CemCode cemoment@aliyun.com
 * @Date: 2022-04-13 16:57:25
 * @LastEditors: CemCode cemoment@aliyun.com
 * @LastEditTime: 2022-12-07 06:36:50
 * @FilePath: \vue-blog-2\src\App.vue
 * @Description: 
 * 
 * Copyright (c) 2022 by CemCode cemoment@aliyun.com, All Rights Reserved. 
-->
<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
import {$theme } from '@/api/admin/index'
import {$articleLabels,$articleTypes} from '@/api/desk';

export default {
  created() {
    this.getThemeColor()
    console.log(this);

    // console.log不好用，每次都要自己手动展开数据
    console.__proto__.lg = (params)=>console.log(JSON.parse(JSON.stringify(params)));

    this.getArticleTypes()
    this.getArticleLabels()
  },
  methods: {

    // 获取主题颜色
    getThemeColor() {
      $theme().then(result => {
        this.$store.dispatch('setPrimary', result.data.themeColor)
      })
    },
    
    // 获取文章类型
    getArticleTypes() {
      $articleTypes().then(res => {
        console.log("main get types",res);
        this.$store.dispatch('setTypesAction', res.data)
      })
    },

    // 获取文章标签
    getArticleLabels() {
      $articleLabels().then(res => {
        console.log("main get label",res);
        this.$store.dispatch('setLabelsAction', res.data)
      })
    }
  }
}
</script>
<style lang="scss">
* {
  font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;
}

// 给nprogress调整一下优先级
#nprogress{
  z-index: 1000;
  .bar{
    background-color: #00ff9d !important;
  }
}

.hljs{
  border-radius: 10px;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
dl,
dd,
ol,
ul,
li,
table,
textarea,
th,
td,
form,
p,
select,
option,
input,
pre {
  margin: 0;
  padding: 0;
}

body,
html,
#app {
  width: 100%;
  height: 100%;
}

@font-face {
  font-family: "iconfont";
  src: url("../public/iconfont/iconfont.woff2?t=1647163679968") format("woff2"),
    url("../public/iconfont/iconfont.woff?t=1647163679968") format("woff"),
    url("../public/iconfont/iconfont.ttf?t=1647163679968") format("truetype");
}

.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  color: #999;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
</style>
